package com.ybox.app.api.service;

import com.ybox.app.api.domain.AppCollectArticle;
import com.ybox.app.api.factory.RemoteAppCollectArticleFallbackFactory;
import com.ybox.common.core.constant.SecurityConstants;
import com.ybox.common.core.constant.ServiceNameConstants;
import com.ybox.common.core.web.domain.AjaxResult;
import feign.Headers;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * 文件服务
 * 
 * @author ych
 */
@FeignClient(contextId = "remoteAppCollectArticleService", value = ServiceNameConstants.APP_SERVICE, fallbackFactory = RemoteAppCollectArticleFallbackFactory.class)
public interface RemoteAppCollectArticleService
{
    /**
     * 更具id查询
     * @param id id
     * @return AjaxResult
     */
    @GetMapping("/article/{id}")
    AjaxResult queryById(@PathVariable("id") String id);

    /**
     * 新增数据
     *
     * @param appCollectArticle 实体
     * @return 新增结果
     */
    @PostMapping("/article")
    @Headers({"acceptEncoding: gzip","contentType: application/json"})
    AjaxResult addInner(@Validated(AppCollectArticle.insert.class) @RequestBody AppCollectArticle appCollectArticle, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 编辑数据
     *
     * @param appCollectArticle 实体
     * @return 编辑结果
     */
    @PutMapping("/article")
    AjaxResult edit(@Validated @RequestBody AppCollectArticle appCollectArticle);

    /**
     * 删除收藏
     * @param collectIds 收藏ids
     * @return 删除是否成功
     */
    @DeleteMapping("/article/{collectIds}")
    AjaxResult remove(@PathVariable(value="collectIds") String[] collectIds);
}
